<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

<% 
  String username=(String) session.getAttribute("UserName");
	  if(username == null)
	  	username = "";
	  if(username.compareTo("admin") == 0 || username.compareTo("dung") == 0 )
	  {
		  //response.sendRedirect("index.jsp");
	  }
	  else
		  response.sendRedirect("ShowNotice2.jsp");
%>

<tiles:insertTemplate template="Template.jsp">

	<tiles:putAttribute name="head">
		<h2>MANAGER</h2>
		<!-- bootstrap styles -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.css" rel="stylesheet">
    <style type="text/css">
        .label
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 11px;
         
        }
        .tableBorder
        {
            border: solid 1px #0066FF;
            margin-top: 10px;
        }
        .message
        {
            font-family: Verdana, Arial, Helvetica, sans-serif;
            font-size: 14px;
            font-weight: bold;
            color:White;
            text-align: left;
        }
    </style>
    <style type="text/css">
        #container
        {
            width: 800px;
            margin: auto;
            text-align: center;
        }
        .text
        {
            width: auto;
            text-align: left;
            background-color: Green;
            color: White;
            font-weight: bold;
            padding: 5px;
            clear: both;
        }
        .left
        {
            width: 200px;
            float: left;
            text-align: right;
            color: Green;
            font-size: larger;
        }
        .right
        {
            width: 550px;
            float: right;
            text-align: left;
            margin-left: 40px;
            color: Green;
            font-size: large;
        }
        #center
        {
            width: auto;
            color: Green;
            text-align: center;
        }
        .box
        {
            width: 310px;
        }
    </style>
	</tiles:putAttribute>
	
	<tiles:putAttribute name="body">
<h3 style="text-align: center; color: red;">${errors}</h3>
<form action="Customer.do" method="post">
  <table cellpadding="4px" cellspacing="4px" bgcolor="#F4F5F7" width="500px" class="tableBorder"
        align="center" >
        
       <tr>
            <td colspan="2" bgcolor="#0071bd" align="center">
                <span class="message">Manager Customer</span>
            </td>
        </tr>   
    <tr>
      <td class="label" align="left" style="font-weight: bold">Id</td>
      <td><input type="text" class="box" name="txtId" value="${cus.Id}"/></td>
    </tr>
      <tr>
      <td class="label"  align="left" style="font-weight: bold" >Password</td>
      <td>
      		<input  type="password" class="box" name="txtPassword"  class="box" value="${cus.Password}" />	
         	<input type="hidden" value="${cus.password }" name="hhdPassword" class="box"/>
      
      </td>
    </tr>
    <tr>
      <td class="label" align="left" style="font-weight: bold">Full Name</td>
      <td><input  type="text" name="txtFullName" class="box" value="${cus.FullName}" /></td>
    </tr>
    <tr>
      <td class="label" align="left" style="font-weight: bold">Address</td>
      <td><input type="text" name="txtAddress" class="box" value="${cus.Address}" /></td>
    </tr>
    <tr>
      <td class="label" align="left" style="font-weight: bold">Emails</td>
      <td><input type="text" name="txtEmail" class="box" value="${cus.Email}" /></td>

    </tr>
    <tr>
            <td class="label" align="left" style="font-weight: bold">
                Actived :
            </td>
            <td align="left" >
               <input type="radio" name="rdoActived" class="box" value="true" ${c.activated?'checked':'' }/> &nbsp;Active &nbsp;
               <input type="radio" name="rdoActived" class="box" value="false" ${c.activated?'':'checked' }/> &nbsp;No Active  &nbsp;
            </td>
        </tr>
    <tr>

     <td align="center" colspan="2" class="">
                <input type="submit" name="btnInsert" style="height: 30px;width: 100px;" class="btn btn-small btn-warning btn-success" value="Insert">
                &nbsp;
                <input type="submit" name="btnUpdate" style="height: 30px;width: 100px;" class="btn btn-small btn-warning btn-primary" value="Update">
                &nbsp;
                <input type="submit" name="btnDelete" style="height: 30px;width: 100px;"  class="btn btn-small btn-warning btn-danger" value="Delete">
            </td>
    </tr>
  </table>
  </form>

  <table class="table table-bordered" style="width: 90%;margin: 0px auto;">
  	     <tr align="center">
              		<td align="center" colspan="7">
	              		<form class="form-search" action="Customer.do" method="post">
	    					<input type="text" name="txtSearch" class="input-medium search-query">
	    					<input type="submit" name="btnSearch1" class="btn" value="Search">
	    				</form>
              		</td>
              	</tr>
    <tr bgcolor="lightgray">
      <th>Id</th>
      <th>Password</th>
      <th>FullName</th>
      <th>Address</th>
      <th>Email</th>
      <th>Activated</th>
      <th>&nbsp;</th>
    </tr>
    <c:forEach var="c" items="${cuss.rows}">
    <tr>
      <td>${c.Id}</td>
      <td>${c.Password}</td>
      <td>${c.FullName}</td>
      <td>${c.Address}</td>
      <td>${c.Email}</td>
      <td>${c.activated }</td>
      <td><a href="?lnkEdit&txtId=${c.Id}">Edit</a></td>
    </tr>
    </c:forEach>
    </table>

	</tiles:putAttribute>
	
</tiles:insertTemplate>